<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>工单基本信息管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            //$("#name").focus();
            $("#inputForm").validate({
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });
    </script>
</head>
<body>
<form:form id="inputForm" modelAttribute="zlmtWorksheet" action="${ctx}/worksheet/zlmtWorksheet/save" method="post"
           class="form-horizontal">
    <form:hidden path="id"/>
    <form:hidden path="act.taskId"/>
    <form:hidden path="act.taskName"/>
    <form:hidden path="act.taskDefKey"/>
    <form:hidden path="act.procInsId"/>
    <form:hidden path="act.procDefId"/>
    <form:hidden id="flag" path="act.flag"/>
    <sys:message content="${message}"/>
    <fieldset>
        <legend>资源申请单</legend>
        <table class="table-form">
            <tr>
                <td class="tit">编码：</td>
                <td>
                    <form:input path="worksheetCode" htmlEscape="false" maxlength="64" class="input-small "/>
                </td>
                <td>标题：</td>
                <td>
                    <form:input path="worksheetTitle" htmlEscape="false" maxlength="256" class="input-xlarge "/>
                </td>
            </tr>
            <tr>
                <td class="tit">要求开始处理时间：</td>
                <td>
                    <input name="reqBeginTime" type="text" readonly="readonly" maxlength="20"
                           class="input-medium Wdate "
                           value="<fmt:formatDate value="${zlmtWorksheet.reqBeginTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                </td>
                <td class="tit">要求处理结束时间：</td>
                <td>
                    <input name="reqThruTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
                           value="<fmt:formatDate value="${zlmtWorksheet.reqThruTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                </td>

            </tr>
            <tr>
                <td class="tit">申请原因：</td>
                <td colspan="3">
                    <form:input path="worksheetReason" htmlEscape="false" maxlength="256" class="input-xlarge"
                                style="width:720px;"/>
                </td>
            </tr>
            <tr>
                <td class="tit">期望处理结果：</td>
                <td colspan="3">
                    <form:input path="worksheetReq" htmlEscape="false" maxlength="256" class="input-xlarge "
                                style="width:720px;"/>
                </td>
            </tr>
            <tr>
                <td class="tit">资源：</td>
                <td colspan="3"><%-- type=1选择机柜，type=2选择主机,type=3选择配件 --%>
                    <sys:treeselect name="zlmtResourceWorksheet.hostid" id="zlmtResourceWorksheet"
                                    value="${zlmtResourceWorksheet.hostid}" labelName="zlmtResourceWorksheet.hostName"
                                    labelValue="${zlmtResourceWorksheet.hostName}"
                                    title="资源" url="/inventory/zlmtCabinet/treeData?type=2" cssClass="input-small"
                                    allowClear="true" notAllowSelectParent="true"/>
                </td>
            </tr>
            <tr>
                <td class="tit">附件：</td>
                <td>
                    <form:hidden id="fileName" path="zlmtWorksheetFile.fileUrl" htmlEscape="false" maxlength="255"
                                 class="input-xlarge"/>
                    <sys:ckfinder input="fileName" type="files" uploadPath="/files" readonly="false"
                                  selectMultiple="true" maxWidth="100" maxHeight="100"/>
                </td>
            </tr>
            <tr>
                <td class="tit">备注信息：</td>
                <td colspan="3">
                    <form:textarea path="remarks" class="required" rows="5" maxlength="200" cssStyle="width:500px"/>
                </td>
            </tr>
        </table>
    </fieldset>

    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary" type="submit" value="提交申请" onclick="$('#flag').val('yes')"/>&nbsp;
        <c:if test="${not empty zlmtWorksheet.id}">
            <input id="btnSubmit2" class="btn btn-inverse" type="submit" value="销毁申请" onclick="$('#flag').val('no')"/>&nbsp;
        </c:if>
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
    <c:if test="${not empty zlmtWorksheet.id}">
        <act:histoicFlow procInsId="${zlmtWorksheet.act.procInsId}"/>
    </c:if>
</form:form>
</body>
</html>